/**
 * Created by MF839 on 16/5/19.
 */
;(function($, window, document,undefined) {
    $.fn.tabs = function (options) {
        var settings = {
            tabList: ".Js_tab li",//tab list
            tabContent: ".js_tab_content .Js_tab_main",//内容box
            tabOn:"active",//当前tab类名
            action: "mouseover"//事件，mouseover或者click
        };
        var _this = $(this);
        if (options) $.extend(settings, options);
        _this.find(settings.tabContent).eq(0).show(); //第一栏目显示
        _this.find(settings.tabList).eq(0).addClass(settings.tabOn);
        if (settings.action == "mouseover") {
            _this.find(settings.tabList).each(function (i) {
                $(this).mouseover(function () {
                    $(this).addClass(settings.tabOn).siblings().removeClass(settings.tabOn);
                    var _tCon = _this.find(settings.tabContent).eq(i);
                    _tCon.show().siblings().hide();
                }); //滑过切换
            });
        }
        else if (settings.action == "click") {
            _this.find(settings.tabList).each(function (i) {
                $(this).click(function () {
                    $(this).addClass(settings.tabOn).siblings().removeClass(settings.tabOn);
                    var _tCon = _this.find(settings.tabContent).eq(i);
                    _tCon.show().siblings().hide();
                }); //点击切换
            });
        };
    };
})(jQuery, window, document);